package spring.dao.ejemplos.tasks.dao.jdbc;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;

import spring.dao.ejemplos.tasks.dao.TaskDAO;
import spring.dao.ejemplos.tasks.model.Task;

public class JDBCNamedParameterTaskDao implements TaskDAO {

	private NamedParameterJdbcTemplate namedJdbcTemplate;

	public void addTask(Task task) {
		String sql = "INSERT INTO tasks (id, summary, completed, user) VALUES (:id, :summary, :completed, :user)";
		Map params = new HashMap();
		params.put("id", task.getId());
		params.put("summary", task.getSummary());
		params.put("completed", task.isComplete());
		params.put("user", task.getUser());
		namedJdbcTemplate.update(sql, params);
	}

	public Task getTask(int id) {
		// TODO Auto-generated method stub
		return null;
	}

	public List<Task> getTasks(String username) {
		// TODO Auto-generated method stub
		return null;
	}

	public void updateTask(Task task) {
		// TODO Auto-generated method stub

	}

	public NamedParameterJdbcTemplate getNamedJdbcTemplate() {
		return namedJdbcTemplate;
	}

	public void setNamedJdbcTemplate(NamedParameterJdbcTemplate namedJdbcTemplate) {
		this.namedJdbcTemplate = namedJdbcTemplate;
	}

	public void transferTask(String fromUser, String toUser, Task task) {
		// TODO Auto-generated method stub
		
	}
	
}
